package demo.redis.service;

import java.io.Serializable;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @author Arnold Yand
 * @since Nov 22, 20172:50:22 PM
 * @summary demo.redis.service.RedisServiceImpl.java
 */
@Service("redisService")
public class RedisServiceImpl implements IRedisService{

  @Autowired
  protected RedisTemplate<Serializable, Serializable> redisTemplate;

  @Override
  public void putList(Serializable key, Serializable value) throws Exception {
    redisTemplate.opsForList().leftPush(key, value);
  }

  @Override
  public Object popList(Serializable key) throws Exception {
    return redisTemplate.opsForList().rightPop(key);
  }

}
